<template>
    <div id="paintNewPassword" class="person-detail">
        <div>
            <van-nav-bar
                :fixed="true"
                title="修改密码"
                left-arrow
                @click-left="back"
                />
        </div>
        <div style="background:#fff;">
           <van-cell-group>
                <van-field
                    v-model="newPassword"
                    label="新密码"
                    placeholder="请填写"
                    autosize
                />
                 <van-field
                    v-model="confirmPassword"
                    label="确认密码"
                    placeholder="请填写"
                    autosize
                />
            </van-cell-group>
            <van-button type="info" class="next-step-button" @click="confirm()">保存</van-button>
        </div>
    </div>
</template>
<script>
import mine from "../../../controller/mine";
export default {
    name: 'paintNewPassword',
    components: {},
    data() {
        return {
            newPassword : '',
            confirmPassword : ''
        }
    },
    computed: {},
    created() {},
    mounted() {},
    methods: {
        back(){
            this.$router.go(-1)
        },
        checkpassword(val1,val2){
            if(val1 == val2){
                return true
            }else{
                return false
            }
        },
        confirm(){
            let isCheck = this.checkpassword(this.newPassword,this.confirmPassword)
            if(isCheck){
                this.$toast('');
                const timer = setInterval(() => {
                    this.$toast.clear()
                    this.$router.push({path:'/home/mine'})
                    clearInterval(timer);
                }, 1000);
            }else{
                this.$toast('error');
            }
        }
    }
}
</script>
<style lang="scss" scoped>
#paintNewPassword>div:nth-child(2){
    text-align: center;
    padding-top: 10%;
}
</style>
<style lang="scss">
@import '../style/index.scss';
</style>
